#！/usr/bin/env bash

NFSSERVERIP=$1
NFSSERVERPATH=$2

if [[ ${NFSSERVERIP} == "" ]]; then
	echo "Usage: $0 <{NFSSERVERIP}> <NFSSERVERPATH: default /data/k8s>"
	exit 1
fi

if [[ ${NFSSERVERPATH} == "" ]]; then
	NFSSERVERPATH="/data/k8s"
fi

cd config

cp -rf nfs-client.tml nfs-client.yaml

sed -i "s#NFSSERVERIP#${NFSSERVERIP}#g" nfs-client.yaml
sed -i "s#NFSSERVERPATH#${NFSSERVERPATH}#g" nfs-client.yaml

kubectl create -f nfs-client.yaml
kubectl create -f nfs-client-sa.yaml
kubectl create -f nfs-client-class.yaml

kubectl get pods
kubectl get storageclass